package com.bjpowernode.appio;

import java.io.FileOutputStream;
import java.io.IOException;

public class MyApp2 {
    public static void main(String[] args) {
        String temp="aaaaaaaaaaaa\nkjhdkjkshkfhskfhkshfkshfkshfk\nsasdfsdfsf";
        String path="d:\\bb.txt";
        //写入文件有是否追加的参数
        try {
            FileOutputStream fileOutputStream=new FileOutputStream(path,false);
            byte[] bytes = temp.getBytes();
            fileOutputStream.write(bytes,0,bytes.length);
            //把缓存的数据写入到文件【FileOutputStream中的flush并没有任何实现】
            fileOutputStream.flush();
            fileOutputStream.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
